#include <iostream>
#include <vector>
#include <fstream>
using namespace  std;
class Solution {
public:
	bool isUgly(int num) {
		if (num <= 0)
			return false;
		if (num == 1)
			return true;
		while(num%2==0)		
			num /= 2;		
		while(num%3==0)		
			num /= 3;		
		while(num%5==0)		
			num /= 5;		
		return num == 1;
	}
};
int main()
{	
	fstream fout("out.txt",ios::out);
	int count = 0;
	for(int i=1;;++i)
	{
		if (Solution().isUgly(i))
		{
			count++;
			cout << count << "\t" << i << endl;
			fout << i << ",";
		}
		if(count==1691)
			break;
	}
	fout << endl;
	return 0;
}